package com.example.yiznspringtestinterface;

import com.example.yiznspringtestinterface.aop.OrderService;
import com.example.yiznspringtestinterface.aop.SavaOrder;
import com.example.yiznspringtestinterface.aop.UpdateOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;


@SpringBootApplication
public class YiznSpringTestInterfaceApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(YiznSpringTestInterfaceApplication.class, args);
    }

    @Autowired
    private OrderService orderService;

    @Override
    public void run(String... args) throws Exception {
        SavaOrder order = new SavaOrder();
        order.setId(1L);
        orderService.saveOrder(order);

        UpdateOrder updateOrder = new UpdateOrder();
        updateOrder.setOrderId(2L);
        orderService.updateOrder(updateOrder);
    }
}
